package com.wlcj.www.enumtype;

public enum ProvinceEnum {
	
	shanxi(1, "山西"),
	beijing(2, "北京"),
	shandong(3, "山东"),
	hebei(5, "河北"),
	neimenggu(6, "内蒙古"),
	liaoning(7, "辽宁"),
	heilongjiang(9, "黑龙江"),
	shanghai(10, "上海"),
	jiangsu(11, "江苏"),
	zhejiang(12, "浙江"),
	anhui(13, "安徽"),
	fujian(14, "福建"),
	henan(16, "河南"),
	hubei(17, "湖北"),
	hunan(18, "湖南"),
	guangdong(19, "广东"),
	chongqing(22, "重庆"),
	sichuan(23, "四川"),
	guizhou(24, "贵州"),
	jiangxi(26, "江西"),
	shanxi2(27, "陕西"),
	qita(28, "其他"),
	tianjin(29, "天津"),
	guangxi(30, "广西"),
	yunnan(31, "云南"),
	ningxia(32, "宁夏"),
	jilin(33, "吉林"),
	hainan(34, "海南"),
	gansu(35, "甘肃"),
	xinjiang(36, "新疆"),
	xizang(37, "西藏"),
	qinghai(38, "青海"),
	taiwan(39, "台湾"),
	xianggang(40, "香港"),
	aomen(41, "澳门"),
	quanguo(42, "全国");
	
	private int code;
	private String desc;
	private ProvinceEnum(int code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
	
	public static ProvinceEnum getEnumByCode(int code) {
		for(ProvinceEnum enumtype:values()) {
			if(code==enumtype.getCode())
				return enumtype;
		}
		return null;
	}
	
	public static ProvinceEnum getEnumByDesc(String desc) {
		for(ProvinceEnum enumtype:values()) {
			if(desc.equals(enumtype.getDesc()))
				return enumtype;
		}
		return null;
	}

}
